<template>
  <div class="search-all">
    <div class="search-bar">
      <form>
        <input
          class="input"
          v-model="value"
          @change="onSearch"
          type="text"
          autofocus="autofocus"
          placeholder="搜索"
        />
        <button @click="onCancel">取消</button>
      </form>
    </div>
    <main>
      <div class="search-appoint">
        <div class="title">指定搜索内容</div>
        <div class="appoint-bar">
          <span>朋友圈</span>
          <span>公众号</span>
          <span>小程序</span>
          <span>表情</span>
        </div>
      </div>
      <div class="recently">
        <div class="title">最近在搜</div>
      </div>
      <div class="descover">
        <div class="title">搜索发现</div>
        <div class="descover-new">
          <div>国台办解读二十大报告涉台内容 <strong>热</strong></div>
          <div>新修改的《中国共产党章程》公布<strong>热</strong></div>
          <div>党的二十大报告诞生记<strong>热</strong></div>
          <div>中方：督促美方停止在台湾问题上玩火</div>
          <div>民宿回应透明底浴缸：不会泄露隐私</div>
          <div>华为前三季度销售收入4458亿</div>
        </div>
      </div>
    </main>
  </div>
</template>

<script>
export default {
  data() {
    return {
      value: "",
    };
  },
  methods: {
    onSearch() {
      console.log(this.value);
    },
    onCancel() {
      this.$router.push({ name: "home" });
    },
  },
};
</script>

<style lang="scss" scoped>
.search-all {
  background-color: rgb(17, 17, 17);
  width: 100%;
  height: 100vh;

  .search-bar {
    width: 100%;
    height: 55px;
    padding: 10px;
    color: white;

    form {
      width: 100%;
      height: 35px;
      display: flex;
      flex-direction: row;
      justify-content: space-around;
      align-items: center;
      position: relative;

      .input {
        width: 80%;
        height: 80%;
        background-color: rgb(24, 24, 24);
        outline: none;
        border: none;
        text-indent: 4rem;
      }

      &::after {
        display: block;
        content: "";
        position: absolute;
        left: 12px;
        top: 3px;
        width: 25px;
        height: 25px;
        background-position: center center;
        background-size: 25px;
        background-image: url("@/assets/image/discover-img/search.png");
      }

      button {
        width: 60px;
        background-color: transparent;
        border: none;
        color: white;
      }
    }
  }

  main {
    padding: 20px;
    color: gray;

    .title {
      margin-bottom: 20px;
    }

    .search-appoint {
      margin-bottom: 30px;

      .appoint-bar {
        font-size: 13px;
        color: rgb(160, 196, 247);
        display: flex;
        flex-direction: row;
        justify-content: space-around;
      }
    }

    .recently {
      height: 100px;

      .title {
        position: relative;
        width: 100%;
        padding-bottom: 10px;
        border-bottom: 1px solid rgba(204, 203, 203, 0.1);

        &::after {
          position: absolute;
          right: 5px;
          top: -5px;
          display: block;
          content: "";
          width: 20px;
          height: 22px;
          background-size: 20px;
          background-image: url("@/assets/image/addressImg/icon10.png");
        }
      }
    }

    .descover {
      line-height: 30px;

      .title {
        margin-bottom: 0;
      }

      .descover-new {
        color: rgb(193, 193, 192);
      }

      strong {
        margin-left: 8px;
        color: rgb(188, 123, 69);
      }
    }
  }
}
</style>